package com.ehome.user.Fragment;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.ehome.user.R;
import com.ehome.user.Utils.GlideImageLoader;
import com.youth.banner.Banner;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/3/6 0006.
 */

public class HomeFragment extends Fragment {

    private Banner banner;
    private TextView textview;
    List<String> images=new ArrayList();

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        images.add("android.resource://com.ehome.user/mipmap/banner1");
        images.add("android.resource://com.ehome.user/mipmap/banner2");
        images.add("android.resource://com.ehome.user/mipmap/banner3");
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.tab_home_fragment, container, false);
        banner = (Banner) view.findViewById(R.id.banner);
        textview= (TextView) view.findViewById(R.id.text);
        initBanner();
        return view;
    }
    private void initBanner() {
        //设置图片加载器
        banner.setImageLoader(new GlideImageLoader());
        //设置图片集合
        banner.setImages(images);
        //banner设置方法全部调用完毕时最后调用
        banner.isAutoPlay(false);
        banner.start();
    }

}
